//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tools\fn_triggerToMarker.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_trigger","_shape","_marker","_marker_name"];
DEFAULT_PARAM(_trigger,0,objNull);
DEFAULT_PARAM(_marker_name,1,"");

_shape = [_trigger] call FFUNC(toShape);

if (!IS_STRING(_marker_name)) then { _marker_name = "" };
if (_marker_name == "") then {
	_marker_name = format["marker_trigger_%1%2%3",(_Shape select TMF_SHAPE_CENTER) select 0,(_Shape select TMF_SHAPE_CENTER) select 1,(_Shape select TMF_SHAPE_CENTER) select 2];
};
_marker = createMarker [_marker_name, (_Shape select TMF_SHAPE_CENTER) ];
_marker setMarkerDir (_Shape select TMF_SHAPE_ANGLE);
_marker setMarkerShape "ELLIPSE";
if (_Shape select TMF_SHAPE_RECTANGLE) then { _marker setMarkerShape "RECTANGLE"; };
_marker setMarkerSize [(_Shape select TMF_SHAPE_WIDTH), (_Shape select TMF_SHAPE_HEIGHT)];

TRACE_1("End",_marker);
TMFPROFILERSTOP;
_marker;